package com.gardenguell.salad.util;

import android.view.View;

/**
 * Created by absurd on 2015/11/24.
 */
public class ViewUtil {
    public static View setChildOnClickListener(View parent, int cid,
                                               View.OnClickListener listener) {
        if (parent != null) {
            View v = parent.findViewById(cid);
            if (v != null) {
                v.setOnClickListener(listener);
            }
            return v;
        }
        return null;
    }

    public static void setChildOnClickListener(View parent, int[] cids,
                                               View.OnClickListener listener) {
        if (parent != null && cids != null) {
            for (int cid: cids) {
                View v = parent.findViewById(cid);
                if (v != null) {
                    v.setOnClickListener(listener);
                }
            }
        }
    }


}



